package com.powernode.feign.fallbackfactory;

import com.powernode.domain.Prod;
import com.powernode.feign.StoreProdFeign;
import com.powernode.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @create: 2024/7/19
 * @author: gyhe10
 * @description: 门店业务模块调用商品业务模块feign接口的熔断降级工厂类
 **/

@Component
@Slf4j
public class StoreProdFeignFallbackFactory implements FallbackFactory<StoreProdFeign> {
    @Override
    public StoreProdFeign create(Throwable cause) {
        return new StoreProdFeign() {
            @Override
            public Result<List<Prod>> getProdListByIds(List<Long> prodIds) {
                log.error("调用商品业务模块中根据商品ID集合查询商品对象集合的feign接口失败，原因：{}", cause.getMessage());
                return null;
            }
        };
    }
}
